/**
 * 
 */
package com.macasa.panel.exception;


/**
 * Class DalException
 * <P>
 * 
 * @author Mickaël Husson
 * @date 12 septembre 2011
 */
public class DALException extends Exception {

	/** long serialVersionUID */
	private static final long	serialVersionUID	= -3445162896367005605L;

	/**
	 * The Enum EServiceExceptionType.
	 */
	public enum ERROR_CODE {

		/** Data not found. */
		DATA_NOT_FOUND,
		/** Error from dao */
		DATABASE_ERROR,
		/** No service available. */
		NO_SERVICE_AVAILABLE,
		/** The Service call error. */
		SERVICE_CALL_ERROR;
	}

	/** The code. */
	private final ERROR_CODE	code;

	/**
	 * Instantiates a new dal exception.
	 * 
	 * @param throwable
	 *            the nested exception
	 * @param code
	 *            the error type code
	 */
	public DALException(final Throwable throwable, final ERROR_CODE code) {
		super(throwable);
		this.code = code;
	}

	/**
	 * Gets the error type code.
	 * 
	 * @return the error code
	 */
	public ERROR_CODE getCode() {
		return this.code;
	}
}
